package com.zoo.wuhua.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.zoo.wuhua.entity.Book;

/**
 * <b>spring boot整合Thymeleaf，控制器示例</b><br>
 *
 * @author zhangli7@yusys.com.cn
 * @since 2019年10月24日 下午7:56:28
 */
@RestController
public class ThymeleafController {

	@Autowired
	private Book book;

	@RequestMapping("/bookTable")
	public ModelAndView book() {
		ModelAndView mv = new ModelAndView();
		List<Book> books = new ArrayList<>();
		books.add(book);
		books.add(book);
		books.add(book);
		mv.addObject("books", books);
		mv.setViewName("bookTable"); // 模板文件名称，不含后缀
		return mv;
	}
}
